Implement session persistence and chat history retrieval#9
Conversation
- Refactored `ChatMessage` class to include `senderName`. - Updated `ChatService` to store sender names when adding user and assistant messages. - Added logic to persist and retrieve sessions via `sessionId` in the frontend. - Prefetched session chat history on page load and rendered stored messages in the chat window.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
This pull request introduces improvements to the chat functionality, focusing on better user experience and enhanced message tracking. The main changes include persisting chat sessions across page reloads, associating sender names with chat messages, and restoring chat history when the page loads.
Chat session persistence and restoration:
getSessionIdfunction inapp.jsto store and reuse a unique session ID inlocalStorage, ensuring chat sessions persist across page reloads. ThechatStateobject now initializessessionIdusing this function.DOMContentLoadedevent listener inapp.jsthat fetches and restores the chat history for the current session from the backend when the page loads, displaying previous messages in the chat window.Message structure and sender tracking:
ChatMessageclass to include asenderNamefield and adjusted its constructor accordingly inChatMessage.java.ChatService.javato include the sender's name when adding messages to the chat session: "You" for user messages and the personality name for assistant messages.- RefactoredChatMessageclass to includesenderName.ChatServiceto store sender names when adding user and assistant messages.sessionIdin the frontend.